package com.ght.springboot.dao;

import com.ght.springboot.api.query.CommentQuery;
import com.ght.springboot.elasticsearch.Document;
import com.ght.springboot.vo.CommentBookVo;
import com.ght.springboot.vo.Criteria;

import java.util.List;

public interface IDDocumentDao {

    /**
     * 插入
     *
     * @param doc
     * @return
     */
    boolean insert(Document doc);

    /**
     * 替换
     *
     * @param doc
     * @return
     */
    boolean replace(Document doc);

    /**
     * 更新
     *
     * @param doc
     * @return
     */
    boolean update(Document doc);


    /**
     * 删除
     *
     * @param id
     * @return
     */
    boolean delete(long id);

    /**
     * 根据ID查询
     *
     * @param id
     * @return
     */
    Document searchById(long id);

    /**
     * 条件查询
     *
     * @param criterias
     * @return
     */
    List<CommentBookVo> search(CommentQuery query);

    /**
     * 条件删除
     *
     * @param criterias
     * @return 删除的document数量
     */
    int deleteByQuery(List<Criteria> criterias);


}
